Upgrade to Jackson 3#934
Merged
dennisvang merged 2 commits intoJun 22, 2026
Merged
Conversation
dennisvang
force-pushed
the
maintenance/933-upgrade-to-jackson-3
branch
from
June 22, 2026 10:55
f96ad3a to
99fce99
Compare
this fixes the following error: "Cannot map null into type boolean (set DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES to 'false' to allow)"
- fix corresponding imports: com.fasterxml.jackson moved to tools.jackson except for com.fasterxml.jackson.annotation - replace JsonProcessingException by JacksonException - replace MappingJackson2HttpMessageConverter by JacksonJsonHttpMessageConverter
dennisvang
force-pushed
the
maintenance/933-upgrade-to-jackson-3
branch
from
June 22, 2026 17:20
99fce99 to
f5b15b0
Compare
dennisvang
marked this pull request as ready for review
June 22, 2026 17:50
dennisvang
merged commit Jun 22, 2026
93e6a36
into
maintenance/920-upgrade-to-spring-boot-4
13 checks passed
This was referenced Jun 22, 2026
dennisvang
added a commit
that referenced
this pull request
Jun 26, 2026
* bump spring-boot-starter-parent from 3.5.14 to 4.1.0 (latest) * Upgrade to Jackson 3 (#934) * upgrade fairdatateam packages: - bump spring-security-acl-mongodb version from 6.0.4 to 6.0.5 - bump rdf-resource-resolver version from 0.2.0 to 0.2.2 - bump spring-rdf-migration version from 2.0.0 to 2.0.1 * replace spring.data.mongodb by spring.mongodb in application.yml see https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Configuration-Changelog * rename spring-boot-starter-aop to spring-boot-starter-aspectj see https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Migration-Guide#aop-starter-pom * replace deprecated spring-boot-starter-web by spring-boot-starter-webmvc and replace spring-boot-starter-test by spring-boot-starter-webmvc-test (which brings in spring-boot-starter-test as transitive dependency) https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Migration-Guide#deprecated-starters https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Migration-Guide#test-code * remove android-json exclusion from spring-boot-starter-test, as it does not appear to do anything * replace spring-security-test by spring-boot-starter-security-test, as mentioned in https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Migration-Guide#test-code * remove redundant spring-data-mongodb dependency, because this is already pulled in by spring-boot-starter-data-mongodb (via spring-boot-starter-mongodb) https://central.sonatype.com/artifact/org.springframework.boot/spring-boot-starter-data-mongodb/4.0.6 https://central.sonatype.com/artifact/org.springframework.boot/spring-boot-data-mongodb/4.0.6 * replace deprecated PersistenceConstructor by PersistenceCreator (cannot find this in spring-data-commons release notes, but see e.g. spring-projects/spring-data-neo4j@1c11be9) * add spring-boot-starter-restclient and corresponding test starter, fix corresponding RestTemplateBuilder import, and replace deprecated setConnectionTimeout and setReadTimeout calls https://docs.spring.io/spring-boot/3.4/api/java/org/springframework/boot/web/client/RestTemplateBuilder.html * fix imports for AutoConfigureMockMvc and AutoConfigureMockRestServiceServer, because these have been moved from org.springframework.boot.test.autoconfigure.web to two different packages * add spring-boot-starter-micrometer-metrics dependency and fix corresponding metrics imports (see spring-projects/spring-boot#50788) * revert spring-boot-starter-micrometer-metrics dependency because spring-boot-starter-actuator already pulls that in (see https://github.com/spring-projects/spring-boot/blob/2edca39504f8e9c2943262d3e60ba34b0e7751ac/starter/spring-boot-starter-actuator/build.gradle#L25) * remove unused setFromHttpEntity method, because, not only is it unused, but it gives rise to the following error in spring-boot 4: "incompatible types: org.springframework.http.HttpHeaders cannot be converted to java.util.Map<java.lang.String,java.util.List<java.lang.String>>" * fix TestRestTemplate imports (class has been moved to org.springframework.boot.resttestclient package in spring-boot 4) * replace ClientHttpRequestFactorySettings.Redirects by HttpRedirects because org.springframework.boot.http.client.ClientHttpRequestFactorySettings has been removed, apparently * fix HttpHeaders assertions because the class no longer extends MultiValueMap * rearrange httpclient5 dependency (this was listed under 'Test' dependencies, but does not specify the test scope) * explicit dependency on jakarta.servlet-api This is available via spring-boot starters (jetty?), but we depend heavily on this package and import explicitly from it, so better make the dependency explicit. The package version is managed by spring boot. https://docs.spring.io/spring-boot/appendix/dependency-versions/coordinates.html * bump springdoc-openapi-starter-webmvc-ui from 2.8.16 to 3.0.3, for compatibility with spring-boot 4 (spring 7) * add @AutoConfigureTestRestTemplate to WebIntegrationTest because @SpringBootTest no longer provides the TestRestTemplate bean, as mentioned in the migration guide: https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Migration-Guide#using-webclient-or-testresttemplate-and-springboottest * make setup() public in HarvesterServiceTest * clean up spring-boot-starters, following the spring-boot-starter-classic workflow described in the spring boot 4 migration guide * explicit jackson dependency: we import directly from the jackson packages in many places, so the dependency should be explicit instead of only transitive * explicit dependency on spring-boot-data-mongodb * use jspecify @nullable in AbstractMetadataRepository (this is the only use of @nullable in the fdp) * handle null in ResourceDefinitionTargetClassesCache to get rid of the nullpointerexceptions in tests, like: "Cannot invoke org.fairdatateam.fairdatapoint.entity.schema.MetadataSchema.getTargetClasses() because the return value of java.util.Map.get(Object) is null at org.fairdatateam.fairdatapoint.service.resource.ResourceDefinitionTargetClassesCache.lambda$computeCache$2(ResourceDefinitionTargetClassesCache.java:84)" * fix style for ResourceDefinitionTargetClassesCache * configure mongodb uuid representation an alternative would be something like: ```java @configuration public class MongoClientConfig extends AbstractMongoClientConfiguration { @value("${spring.mongodb.database}") private String databaseName; @OverRide protected void configureClientSettings(MongoClientSettings.Builder builder) { builder.uuidRepresentation(UuidRepresentation.STANDARD); } @OverRide protected @nonnull String getDatabaseName() { return databaseName; } } ``` https://docs.spring.io/spring-data/mongodb/reference/migration-guide/migration-guide-4.x-to-5.x.html * explicit no-args constructor for MetadataSchemaDraftDTO marked as @JsonCreator (fixes the "Cannot map `null` into type `boolean`" error) also see FasterXML/jackson-databind#5318 and https://github.com/FasterXML/jackson/wiki/Jackson-Release-3.0#jackson-databind * change MetadataSchemaDraftDTO.abstractSchema boolean to Boolean this fixes the following error: "Cannot map null into type boolean (set DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES to 'false' to allow)" * replace ObjectMapper by JsonMapper with new builder api - fix corresponding imports: com.fasterxml.jackson moved to tools.jackson except for com.fasterxml.jackson.annotation - replace JsonProcessingException by JacksonException - replace MappingJackson2HttpMessageConverter by JacksonJsonHttpMessageConverter * switch WebMvcConfig to constructor autowiring, while we're at it * update configureMessageConverters to use ServerBuilder because the original method is deprecated for removal * annotate ContentNegotiationConfigurer NonNull to match parent signature * explicit dependency on slf4j, because it is used explicitly throughout the code, but was only included transitively (implicitly)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ObjectMapperbyJsonMapperwith new builder apicom.fasterxml.jacksonmoved totools.jacksonexcept forcom.fasterxml.jackson.annotationJsonProcessingExceptionbyJacksonExceptionMappingJackson2HttpMessageConverterbyJacksonJsonHttpMessageConverter(actually a spring thing but the former is deprecated and does not acceptJsonMapper)fixes #933